@extends('extend.admin')
@section('title','博文添加')
@section('content')
<section id="main-content">
    <div class="row">
        <div class="col-md-12">
            <!--breadcrumbs start -->
            <ul class="breadcrumb">
                <li><a href="/admin">首页</a>
                </li>
                <li>博文管理</li>
                <li class="active">发布文章</li>
            </ul>
            <!--breadcrumbs end -->
            <h1 class="h1">发布文章</h1>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
        <form action="/article/insert" method="post" enctype="multipart/form-data">
        @if(count($errors)>0)
            <div class="alert alert-danger alert-dismissable text-center">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
            <strong>
            @foreach ($errors->all() as $error)
                <span class="glyphicon glyphicon-remove"></span>&nbsp;&nbsp;&nbsp;<span>{{ $error }}</span><br>
            @endforeach
            </strong>
            </div>
        @endif
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">编辑文章</h3>
                </div>
                <div class="panel-body">
                    <div class="col-md-12">
                        <div class="col-md-12">
                            <div class="form-group">
                                <label for="exampleInputEmail2">文章标题</label>
                                <input type="text" name="title" class="form-control" id="exampleInputEmail2" placeholder="请输入文章的标题...">
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="col-md-12" style="padding:20px;15px">
                        <label for="exampleInputEmail2">文章分类</label>
                            <select class="form-control" name="articlecate_id">
                                <option value="0">顶级分类</option>
                                @foreach($cates as $k=>$v)
                                        {{$num=substr_count($v->pd,',') }}
                                        {{$v->name=str_repeat('　　',$num).$v->name}}
                                        <option value="{{$v->id}}">{{$v->name}}</option>
                                @endforeach
                            </select>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="col-md-12">
                        <label for="exampleInputEmail2">文章状态</label>
                            发布&nbsp;:&nbsp;<input type="radio" checked name="status" value="1">&nbsp;&nbsp;&nbsp;&nbsp;
                            草稿&nbsp;:&nbsp;<input type="radio" name="status" value="0">
                        </div>
                    </div>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">文章内容</h3>
                </div>
                <div class="panel-body">
                    <div class="form-group">
                        <!-- 加载编辑器的容器 -->
                        <script id="editor" name="content" type="text/plain" style="width:100%;height:300px;"></script>
                        <!-- 配置文件 -->
                        <script type="text/javascript" src="/admins/ueditor/ueditor.config.js"></script>
                        <!-- 编辑器源码文件 -->
                        <script type="text/javascript" src="/admins/ueditor/ueditor.all.js"></script>
                        <!-- 实例化编辑器 -->
                        <script type="text/javascript">
                            var ue = UE.getEditor('editor');
                        </script>
                    </div>
                    <button type="submit" class="btn btn-success"><i class="fa fa-check"></i> 提交</button>
                </div>
               {{csrf_field()}}
            </div>
        </form>
        </div>
    </div>
</section> 
@endsection